package com.hmall.controller;

import com.hmall.service.UserService;
import com.hmall.vo.UserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("process/")
//@CrossOrigin(origins = "http://localhost:8088", maxAge = 3600)
@Api(value = "process操作API", description = "process操作API说明")
public class ProcessController {

    @Autowired
    private UserService userService;

    @GetMapping("selectByUserId")
    @ApiOperation(value="获取用户名")
    public String  selectByUserId(Integer userId){
        return  userService.selectByUserId(userId);
    }

    @GetMapping("selectByRoleIdToUserName")
    @ApiOperation(value="获取用户名和用户ID")
    public UserVo selectByRoleIdToUserName(Integer roleId){
        return userService.selectByRoleIdToUserName(roleId);
    }

    @GetMapping("selectByUserIdToRoleId")
    @ApiOperation(value="获取角色ID")
    public int selectByUserIdToRoleId(Integer userId){
        return userService.selectByUserIdToRoleId(userId);
    }


}
